home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / INT86X.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  1.1 KB  |  45 lines

  1. /* INT86X.C ---p. 628 */
  2. #ifdef EXAMPLE_1
  3. #include <stdio.h>
  4. #include <dos.h>
  5. /* Interrupt number for DOS functions */
  6. #define DOS_INT 0x21
  7. /* DOS "change directory" function */
  8. #define DOS_CHDIR 0x3b
  9. /* Buffer to hold path name    */
  10. static char buff[80];
  11. main()
  12. {
  13.                 /* Far pointer to directory name string*/
  14.     char far *dirname;
  15.                 /* Set up the structure for registers */
  16.     union REGS xr;
  17.     struct SREGS sr;
  18.     printf("Enter pathname: ");
  19.     gets(buff);
  20.                 /* Set up far pointer to name*/
  21.     dirname = &buff[0];
  22.     xr.h.ah = DOS_CHDIR;
  23.                 /* Offset of string to DX    */
  24.     xr.x.dx = FP_OFF(dirname);
  25.                 /* Segment of string to DS */
  26.     sr.ds = FP_SEG(dirname);
  27.     int86x(DOS_INT, &xr, &xr, &xr);
  28. }
  29. #endif
  30. #include <dos.h>
  31. #define DOS_INT    0x21
  32.                 /* DOS "print string" function */
  33. #define DOS_PRTSTR 0x9
  34. char str[]="Testing String Print Function$";
  35. main()
  36. {
  37.     union REGS xr;
  38.     struct SREGS sr;
  39.     xr.h.ah = DOS_PRTSTR;
  40.                 /* Offset string to DX    */
  41.     xr.x.dx = FP_OFF(str);
  42.                 /* Segment of string to DS */
  43.     sr.ds = FP_SEG(str);
  44.     int86x(DOS_INT, &xr, &xr, &sr);
  45. }